for fix in "*.c" "*.cpp" "*.h"
do
    find ./ -name "$fix"|while read file
    do
        sed 's///g;' $file>$file.new;
        echo "">>$file.new
        mv $file.new $file
    done
done


SUINCLUDE='';
SULIB='';
SUBIN='';
SUOBJECTS='';
SUBININSTALLDIR='';
SULIBINSTALLDIR='';
SUINCINSTALLDIR='';
SUADDINCLUDE='';
SUADDLIB='';
SUMAKEGENFLAG='';
SUDEBUGFLAG='';
SUOBJECTCLEANFLAG='';






SUPWD=`pwd`;
rm -rf ${SUPWD}/config.ini.now ${SUPWD}/config.ini.now ${SUPWD}/project.ini.now ${SUPWD}/prepare.sh;
if [ -f ${SUPWD}/config.ini ]
then
    cp ${SUPWD}/config.ini ${SUPWD}/config.ini.now;
else
    touch ${SUPWD}/config.ini.now;
fi


if [ -f ${SUPWD}/list.ini ]
then
    cp ${SUPWD}/list.ini ${SUPWD}/list.ini.now;
else
    touch ${SUPWD}/config.ini.now;
fi
if [ -f ${SUPWD}/project.ini ]
then
    cp ${SUPWD}/project.ini ${SUPWD}/project.ini.now;
else
    touch ${SUPWD}/project.ini.now;
fi
if [ -f ${SUPWD}/prepare.ini ]
then
    cp ${SUPWD}/prepare.ini ${SUPWD}/prepare.sh;
    chmod 777 ${SUPWD}/prepare.sh;
else
    touch ${SUPWD}/prepare.sh;
    chmod 777 ${SUPWD}/prepare.sh;
fi


. ${SUPWD}/prepare.sh;
if [ $? -ne 0 ]
then
    echo "prepare check fail";
    rm -rf ${SUPWD}/config.ini.now ${SUPWD}/list.ini.now ${SUPWD}/project.ini.now ${SUPWD}/prepare.sh;
    return -1;
fi

SUINCLUDE=${SUPWD}/Include;
SULIB=${SUPWD}/Lib;
SUBIN=${SUPWD}/Bin;    
SUOBJECTS=${SUPWD}/Objects;
SUBININSTALLDIR=${SUPWD}/Bin;
SULIBINSTALLDIR=${SUPWD}/Lib;
SUINCINSTALLDIR=${SUPWD}/Include;
SUMAKEGEN=NOTFORCE;
SUDEBUGFLAG=-o2;
SUOBJECTCLEANFLAG=YES;
awk -F'=' 'NF==2' ${SUPWD}/config.ini.now|sed 's/[ 	]*=[ 	]*/=/g;s/^[ 	]*//g;s/[ 	]*$//g;'|grep -f ${SUPWD}/list.ini.now|grep -v "CC="|grep -v "CPP=">${SUPWD}/config.run;
chmod 777 ${SUPWD}/config.run;
. ./config.run;
rm -rf ${SUPWD}/config.run;



awk -F'=' '{print $1}' ${SUPWD}/list.ini.now|grep -v 'FLAG'|while read str
do
    echo "echo \${$str}">${SUPWD}/config.run;
    chmod 777 ${SUPWD}/config.run;
    checkdir=`. ./config.run`;
    rm -rf ${SUPWD}/config.run;
    if [ "X" != "X${checkdir}" ]
    then
        echo "${checkdir}"|awk -F':' '{for(i=1;i<=NF;i++){print $i}}'|while read dir
        do
            if [ ! -d ${dir} ]
            then
                echo "dir:${dir} not found,exits";
                rm -rf ${SUPWD}/config.ini.now ${SUPWD}/list.ini.now ${SUPWD}/project.ini.now ${SUPWD}/prepare.sh;
                exit -1;
            fi
        done
    fi
done



rm -rf ${SUPWD}/mkinstall.tmp ${SUPWD}/mkuninstall.tmp ${SUPWD}/mkclean.tmp;
touch ${SUPWD}/mkinstall.tmp;
touch ${SUPWD}/mkuninstall.tmp;
touch ${SUPWD}/mkclean.tmp;
cat ${SUPWD}/project.ini.now|while read dir
do
    if [ ! -d ${dir} ]
    then
        echo "ProjectDir:${dir} not exists,exit";
        return -1;
    fi
    
    if [ ! -f ${dir}/list.ini ]
    then
        cp prolist.ini ${dir}/list.ini;
    fi
    
    POSRC='';
    POINCLUDE='';
    POLIB='';
    POBIN='';
    POOBJECTS='';
    POBININSTALLDIR='';
    POLIBINSTALLDIR='';
    POINCINSTALLDIR='';
    POINCINSTALLLISTFLAG='';
    POADDINCLUDE='';
    POADDLIB='';
    POMAKEGENFLAG='';
    PODEBUGFLAG='';
    POMAKETYPEFLAG='';
    POOBJECTCLEANFLAG='';
    PODEFFLAG='';
    POTARGETNAMEFLAG='';
    
    
    cd ${dir};
    PJPWD=`pwd`;
    rm -rf ${PJPWD}/config.ini.now ${PJPWD}/list.ini.now ${PJPWD}/project.ini.now;
    if [ -f ${PJPWD}/config.ini ]
    then
        cp ${PJPWD}/config.ini ${PJPWD}/config.ini.now;
    else
        touch ${PJPWD}/config.ini.now;
    fi
    if [ -f ${PJPWD}/list.ini ]
    then
        cp ${PJPWD}/list.ini ${PJPWD}/list.ini.now;
    else
        touch ${PJPWD}/list.ini.now;
    fi
    POSRC=${PJPWD}/Src;
    POINCLUDE=${PJPWD}/Include;
    POMAKETYPEFLAG=SD;
    POOBJECTCLEANFLAG=YES;
    POTARGETNAMEFLAG=${dir};
    rm -rf ${PJPWD}/objectlist.new ${PJPWD}/includelist.new ${PJPWD}/liblist.new ${PJPWD}/makefile;
    touch ${PJPWD}/objectlist.new ${PJPWD}/includelist.new ${PJPWD}/liblist.new;
    awk -F'=' 'NF==2' ${PJPWD}/config.ini.now|sed 's/[ 	]*=[ 	]*/=/g;s/^[ 	]*//g;s/[ 	]*$//g;'|grep -f ${PJPWD}/list.ini.now|grep -v "CC="|grep -v "CPP=">${PJPWD}/config.run;
    chmod 777 ${PJPWD}/config.run;
    . ./config.run;
    rm -rf ${PJPWD}/config.run;
	TMPPOINCINSTALLLISTFLAG=`echo "${POINCINSTALLLISTFLAG}"|awk -F':' '{for(i=1;i<=NF;i++){print $i" "}}'`;
	POINCINSTALLLISTFLAG="${TMPPOINCINSTALLLISTFLAG}"

    
    
    awk -F'=' '{print $1}' ${PJPWD}/list.ini.now|grep -v 'FLAG'|while read str
    do
        echo "echo \${$str}">${PJPWD}/config.run;
        chmod 777 ${PJPWD}/config.run;
        checkdir=`. ./config.run`;
        rm -rf ${PJPWD}/config.run;
        if [ "X" != "X${checkdir}" ]
        then
            echo "${checkdir}"|awk -F':' '{for(i=1;i<=NF;i++){print $i}}'|while read dir
            do
                if [ ! -d ${dir} ]
                then
                    echo "dir:${dir} not found,exits";
                    rm -rf ${PJPWD}/config.ini.now ${PJPWD}/list.ini.now ${PJPWD}/project.ini.now;
                    exit -1;
                fi
            done
    fi
    done
    
    CINCLUDE="";
    CLIB="";
    
    for idir in $POINCLUDE $SUINCLUDE $POADDINCLUDE $SUADDINCLUDE
    do
        if [ "X" != "X${idir}" ]
        then
            mytmp=`echo ${idir}|awk -F':' '{for(i=1;i<=NF;i++){print $i}}'`;
            echo "${mytmp}">>${PJPWD}/includelist.new;
            CINCLUDE="${CINCLUDE} -I${mytmp}";
        fi
    done
    
    for ldir in $POLIB $SULIB $POADDLIB $SUADDLIB
    do
        if [ "X" != "X${ldir}" ]
        then
            mytmp=`echo ${ldir}|awk -F':' '{for(i=1;i<=NF;i++){print $i}}'`
            echo "${mytmp}">>${PJPWD}/liblist.new;
            CLIB="${CLIB} -L${mytmp}";
        fi
    done
    

    
    cd ${POSRC};
    ls|grep '\.[c(cpp)]'>${PJPWD}/objectlist.new;
    cd ${PJPWD};
    
    LINKS="";
    rm -rf ${PJPWD}linksfile;
    touch ${PJPWD}linksfile;
    while read file
    do
        grep '#[ 	]*pragma[ 	]*comment[ 	]*([ 	]*lib[ 	]*,[ 	]*' ${POSRC}/${file}|awk -F'"' '{print $2}'|awk -F'"' '{print $1}'|grep -v '^[ 	]*$'|sed 's/[ 	]*//g;'|while read lib
        do
            cat ${PJPWD}/liblist.new|while read dir
            do
                if [ -f ${dir}/${lib}.${SLNAME} -o -f ${dir}/lib${lib}.${SLNAME} -o -f ${dir}/${lib}.a -o -f ${dir}/lib${lib}.a ]
                then
                    LINKS=`cat ${PJPWD}linksfile`;
                    LINKS="${LINKS} -l${lib}";
                    echo ${LINKS}>${PJPWD}linksfile
                    break;
                fi
            done
        done
    done<${PJPWD}/objectlist.new
    LINKS=`cat ${PJPWD}linksfile`;
    rm -rf ${PJPWD}linksfile;
    
    if [ "SD" != "${POMAKETYPEFLAG}" -a "S" != "${POMAKETYPEFLAG}" -a "D" != "${POMAKETYPEFLAG}" -a "E" != "${POMAKETYPEFLAG}" ]
    then
        MAKETYPEFLAG="SD";
        while read src
        do
            ind=`grep 'main' ${POSRC}/${src}`;
            if [ "X" != "X${ind}" ]
            then
                MAKETYPEFLAG="E";
                break;
            fi
        done<${PJPWD}/objectlist.new
    else
        flag=0;
        while read src
        do
            ind=`grep 'main' ${POSRC}/${src}`;
            if [ "X" != "X${ind}" ]
            then
                flag=1;
                break;
            fi
        done<${PJPWD}/objectlist.new
        if [ 0 -eq $flag -a "E" != "${POMAKETYPEFLAG}" ]
        then
            MAKETYPEFLAG="SD";
        else
            MAKETYPEFLAG=${POMAKETYPEFLAG};
        fi
    fi
    
    MAKEGENFLAG="${POMAKEGENFLAG}"
    if [  "X" = "X${POMAKEGENFLAG}" ]
    then
        MAKEGENFLAG=${SUMAKEGENFLAG};
    fi
    if [ "${MAKEGENFLAG}" != "NOTFORCE" -a "${MAKEGENFLAG}" != "FORCE" ]
    then
        MAKEGENFLAG=NOTFORCE;
    fi
    

    if [  "X" = "X${PODEBUGFLAG}" ]
    then
        if [  "X" = "X${SUDEBUGFLAG}" ]
        then
            DEBUGFLAG="";
        else
            DEBUGFLAG=${SUDEBUGFLAG};
        fi
    fi
    
    OBJECTCLEANFLAG="${POOBJECTCLEANFLAG}"
    if [  "X" = "X${POOBJECTCLEANFLAG}" ]
    then
        OBJECTCLEANFLAG=${SUOBJECTCLEANFLAG};
    fi
    if [ "${OBJECTCLEANFLAG}" != "YES" -a "${OBJECTCLEANFLAG}" != "NO" ]
    then
        OBJECTCLEANFLAG=YES;
    fi
    

    
    if [  "X" = "X${POOBJECTS}" ]
    then
        OBJECTS=${SUOBJECTS};
    fi
    
    if [  "X" = "X${POBININSTALLDIR}" ]
    then
        BININSTALLDIR=${SUBININSTALLDIR};
    fi
    
    if [  "X" = "X${POLIBINSTALLDIR}" ]
    then
        LIBINSTALLDIR=${SULIBINSTALLDIR};
    fi
    
    if [  "X" = "X${POINCINSTALLDIR}" ]
    then
        INCINSTALLDIR=${SUINCINSTALLDIR};
    fi
    
    if [  "X" = "X${POINCINSTALLLISTFLAG}" ]
    then
        INCINSTALLLISTFLAG="";
    else
        INCINSTALLLISTFLAG="${POINCINSTALLLISTFLAG}";
    fi
    
    DEFFLAG=${PODEFFLAG};
    
    TARGETNAMEFLAG=${POTARGETNAMEFLAG};
    
    CCOMPLIER="${CC} -c ${DEBUGFLAG} ${CFLAGS} ${CINCLUDE} ${DEFFLAG} -o";
    CCPPOMPLIER="${CPP} ${DEBUGFLAG} -c ${CXXFLAGS} ${CINCLUDE} ${DEFFLAG} -o";
    CEXELINK="${CC} ${SYSLIBS} ${LINKFLAGS} ${CLIB} ${LINKS} -o";
    CPPEXELINK="${CPP} ${SYSLIBS} ${LINKFLAGS} ${CLIB} ${LINKS}  -o";
    CDLLLINK="${CC} ${SYSLIBS} ${SHARED} ${CLIB} ${LINKS} -o";
    CPPDLLLINK="${CPP} ${SYSLIBS} ${SHARED} ${CLIB} ${LINKS} -o";
    LIBLINK="ar cr";
    VPATH="${POSRC}:${OBJECTS}";
    while read dir
    do
        VPATH="${VPATH}:${dir}";  
    done<${PJPWD}/includelist.new
    while read dir
    do
        VPATH="${VPATH}:${dir}";  
    done<${PJPWD}/liblist.new

    gf=0;
    if [ "${MAKEGENFLAG}" = "FORCE" ]
    then
        rm -rf ${PJPWD}/Makefile;
        touch ${PJPWD}/Makefile;
        gf=1;
    else
        if [ ! -f ${PJPWD}/Makefile ]
        then
            touch ${PJPWD}/Makefile;
            gf=1;
        fi
    fi
    if [ $gf -eq 1 ]
    then
        echo "CCOMPLIER = ${CCOMPLIER}">>${PJPWD}/Makefile;
        echo "CCPPOMPLIER = ${CCPPOMPLIER}">>${PJPWD}/Makefile;
        echo "CEXELINK = ${CEXELINK}">>${PJPWD}/Makefile;
        echo "CPPEXELINK = ${CPPEXELINK}">>${PJPWD}/Makefile;
        echo "CDLLLINK = ${CDLLLINK}">>${PJPWD}/Makefile;
        echo "CPPDLLLINK = ${CPPDLLLINK}">>${PJPWD}/Makefile;
        echo "LIBLINK = ${LIBLINK}">>${PJPWD}/Makefile;
        echo "VPATH = ${VPATH}">>${PJPWD}/Makefile;
        oc=`cat ${PJPWD}/objectlist.new|wc -l`;
        ocname[${oc}]="";
        octype[${oc}]="";
        ocsrc[${oc}]="";
        objects="";
        fullobjects="";
        i=0;
        while read str
        do
            ocsrc[${i}]="${str}";
            ind=`echo "${str}"|grep '\.cpp$'`;
            if [ "X" = "X${ind}" ]
            then
                octype[${i}]="c";
            else
                octype[${i}]="cpp";
            fi
            ocname[${i}]=`echo "${str}"|sed 's/\.cpp$/\.o/g;s/\.c$/\.o/g;'`;
            objects="${objects} ${ocname[${i}]}";
            fullobjects="${fullobjects} ${OBJECTS}/${ocname[${i}]}";
            i=`expr $i + 1`;
        done<${PJPWD}/objectlist.new
        if [ ${MAKETYPEFLAG} = "E" ]
        then
            echo "${TARGETNAMEFLAG}: ${objects}">>${PJPWD}/Makefile;
            echo "	\$(CPPEXELINK) ${OBJECTS}/${TARGETNAMEFLAG} ${fullobjects}">>${PJPWD}/Makefile;
        elif [ ${MAKETYPEFLAG} = "S" ]
        then
            echo "lib${TARGETNAMEFLAG}.a: ${objects}">>${PJPWD}/Makefile;
            echo "	\$(LIBLINK) ${OBJECTS}/lib${TARGETNAMEFLAG}.a ${fullobjects}">>${PJPWD}/Makefile;
        elif [ ${MAKETYPEFLAG} = "D" ]
        then
            echo "lib${TARGETNAMEFLAG}.${SLNAME}: ${objects}">>${PJPWD}/Makefile;
            echo "	\$(CPPDLLLINK) ${OBJECTS}/lib${TARGETNAMEFLAG}.${SLNAME} ${fullobjects}">>${PJPWD}/Makefile;
        elif [ ${MAKETYPEFLAG} = "SD" ]
        then
            echo "lib${TARGETNAMEFLAG}.${SLNAME}: ${objects} lib${TARGETNAMEFLAG}.a">>${PJPWD}/Makefile;
            echo "	\$(CPPDLLLINK) ${OBJECTS}/lib${TARGETNAMEFLAG}.${SLNAME} ${fullobjects}">>${PJPWD}/Makefile;
            echo "lib${TARGETNAMEFLAG}.a: ${objects}">>${PJPWD}/Makefile;
            echo "	\$(LIBLINK) ${OBJECTS}/lib${TARGETNAMEFLAG}.a ${fullobjects}">>${PJPWD}/Makefile;
        fi
        i=0;
        while [ $i -lt $oc ]
        do
            rm -rf ${PJPWD}/mytmplist
            touch ${PJPWD}/mytmplist
            echo ${POSRC}/${ocsrc[${i}]}>>${PJPWD}/mytmplist;
            flag=0;
            while [ $flag -eq 0 ]
            do
                rm -rf ${PJPWD}/mytmptmp;
                touch ${PJPWD}/mytmptmp;
                cat ${PJPWD}/mytmplist|while read file
                do
                    grep '#[ 	]*include' ${file}|awk -F'<' '{print $2}'|awk -F'>' '{print $1}'|grep -v '^[ 	]*$'|sed 's/[ 	]*//g;'>>${PJPWD}/mytmptmp;
                    grep '#[ 	]*include' ${file}|awk -F'"' '{print $2}'|awk -F'"' '{print $1}'|grep -v '^[ 	]*$'|sed 's/[ 	]*//g;'>>${PJPWD}/mytmptmp;
                done
                localfg=0;
                cat ${PJPWD}/mytmptmp|while read file
                do
                    cat ${PJPWD}/includelist.new|while read dir
                    do
                        if [ -f ${dir}/${file} ]
                        then
                            ind=`grep "${file}" ${PJPWD}/mytmplist`
                            if [ "X" = "X${ind}" ]
                            then
                                echo "${dir}/${file}">>${PJPWD}/mytmplist;
                                localfg=1;
                                break;
                            fi
                        fi
                    done
                done
                if [ $localfg -ne 1 ]
                then
                    flag=1;
                fi
                rm -rf ${PJPWD}/mytmptmp;
            done
            touch ${PJPWD}/mytmptmp;
            grep '#[ 	]*pragma[ 	]*comment[ 	]*([ 	]*lib[ 	]*,[ 	]*' ${POSRC}/${ocsrc[${i}]}|awk -F'"' '{print $2}'|awk -F'"' '{print $1}'|grep -v '^[ 	]*$'|sed 's/[ 	]*//g;'>>${PJPWD}/mytmptmp;
            cat ${PJPWD}/mytmptmp|while read file
            do
                cat ${PJPWD}/liblist.new|while read dir
                do
                    if [ -f ${dir}/${file}.${SLNAME} ]
                    then
                        echo ${dir}/${file}.${SLNAME}>>${PJPWD}/mytmplist;
                        break;
                    elif [ -f ${dir}/lib${file}.${SLNAME} ]
                    then
                        echo ${dir}/lib${file}.${SLNAME}>>${PJPWD}/mytmplist;
                        break;
                    elif [ -f ${dir}/${file}.a ]
                    then
                        echo ${dir}/${file}.a>>${PJPWD}/mytmplist;
                        break;
                    elif [ -f ${dir}/lib${file}.a ]
                    then
                        echo ${dir}/lib${file}.a>>${PJPWD}/mytmplist;
                        break;
                    fi
                done
            done
            rm -rf ${PJPWD}/mytmptmp;
            mydp="";
            while read str
            do
               fname=`basename "${str}"`;
               mydp="${mydp} ${fname}";
            done<${PJPWD}/mytmplist
            rm -rf ${PJPWD}/mytmplist
            echo "${ocname[${i}]}: ${mydp}">>${PJPWD}/Makefile;
            if [ "${octype[${i}]}" = "cpp" ]
            then
                echo "	\$(CCPPOMPLIER) ${OBJECTS}/${ocname[${i}]} ${POSRC}/${ocsrc[${i}]}">>${PJPWD}/Makefile;
            else
                echo "	\$(CCOMPLIER) ${OBJECTS}/${ocname[${i}]} ${POSRC}/${ocsrc[${i}]}">>${PJPWD}/Makefile;
            fi
            i=`expr $i + 1`;
        done
    fi
    if [ ${MAKETYPEFLAG} = "E" ]
    then
        echo ".PHONY : clean">>${PJPWD}/Makefile;
        echo "clean:">>${PJPWD}/Makefile;
        echo "	rm -rf ${OBJECTS}/${TARGETNAMEFLAG} ${fullobjects}">>${PJPWD}/Makefile;
        echo ".PHONY : install">>${PJPWD}/Makefile;
        echo "install:">>${PJPWD}/Makefile;
        echo "	cp -f ${OBJECTS}/${TARGETNAMEFLAG} ${BININSTALLDIR}">>${PJPWD}/Makefile;
        if [ "YES" = "${OBJECTCLEANFLAG}" ]
        then
            echo "	rm -rf ${OBJECTS}/${TARGETNAMEFLAG} ${fullobjects}">>${PJPWD}/Makefile;
        fi
        
        
        if [ "X" != "X${INCINSTALLLISTFLAG}" ]
        then
            for icfile in ${INCINSTALLLISTFLAG}
            do
                cat ${PJPWD}/includelist.new|while read dir
                do
                    if [ -f ${dir}/${icfile} ]
                    then
                        echo "	cp -f ${dir}/${icfile} ${INCINSTALLDIR}">>${PJPWD}/Makefile;
                        break;
                    fi
                done
            done
        fi
        echo ".PHONY : uninstall">>${PJPWD}/Makefile;
        echo "uninstall:">>${PJPWD}/Makefile;
        echo "	rm -rf ${BININSTALLDIR}/${TARGETNAMEFLAG}">>${PJPWD}/Makefile;
        if [ "YES" = "${OBJECTCLEANFLAG}" ]
        then
            echo "	rm -rf ${OBJECTS}/${TARGETNAMEFLAG} ${fullobjects}">>${PJPWD}/Makefile;
        fi
        if [ "X" != "X${INCINSTALLLISTFLAG}" ]
        then
            for icfile in ${INCINSTALLLISTFLAG}
            do
                echo "	rm -rf  ${INCINSTALLDIR}/${icfile}">>${PJPWD}/Makefile;
            done
        fi
        
        
    elif [ ${MAKETYPEFLAG} = "S" ]
    then
        echo ".PHONY : clean">>${PJPWD}/Makefile;
        echo "clean:">>${PJPWD}/Makefile;
        echo "	rm -rf ${OBJECTS}/lib${TARGETNAMEFLAG}.a ${fullobjects}">>${PJPWD}/Makefile;
        echo ".PHONY : install">>${PJPWD}/Makefile;
        echo "install:">>${PJPWD}/Makefile;
        echo "	cp -f ${OBJECTS}/lib${TARGETNAMEFLAG}.a ${LIBINSTALLDIR}">>${PJPWD}/Makefile;
        if [ "YES" = "${OBJECTCLEANFLAG}" ]
        then
            echo "	rm -rf ${OBJECTS}/lib${TARGETNAMEFLAG}.a ${fullobjects}">>${PJPWD}/Makefile;
        fi
        
        if [ "X" != "X${INCINSTALLLISTFLAG}" ]
        then
            for icfile in ${INCINSTALLLISTFLAG}
            do
                cat ${PJPWD}/includelist.new|while read dir
                do
                    if [ -f ${dir}/${icfile} ]
                    then
                        echo "	cp -f ${dir}/${icfile} ${INCINSTALLDIR}">>${PJPWD}/Makefile;
                        break;
                    fi
                done
            done
        fi
        echo ".PHONY : uninstall">>${PJPWD}/Makefile;
        echo "uninstall:">>${PJPWD}/Makefile;
        echo "	rm -rf ${LIBINSTALLDIR}/lib${TARGETNAMEFLAG}.a">>${PJPWD}/Makefile;
        if [ "YES" = "${OBJECTCLEANFLAG}" ]
        then
            echo "	rm -rf ${OBJECTS}/lib${TARGETNAMEFLAG}.a ${fullobjects}">>${PJPWD}/Makefile;
        fi
        if [ "X" != "X${INCINSTALLLISTFLAG}" ]
        then
            for icfile in ${INCINSTALLLISTFLAG}
            do
                echo "	rm -rf  ${INCINSTALLDIR}/${icfile}">>${PJPWD}/Makefile;
            done
        fi
        
        
    elif [ ${MAKETYPEFLAG} = "D" ]
    then
        echo ".PHONY : clean">>${PJPWD}/Makefile;
        echo "clean:">>${PJPWD}/Makefile;
        echo "	rm -rf ${OBJECTS}/lib${TARGETNAMEFLAG}.${SLNAME} ${fullobjects}">>${PJPWD}/Makefile;
        echo ".PHONY : install">>${PJPWD}/Makefile;
        echo "install:">>${PJPWD}/Makefile;
        echo "	cp -f ${OBJECTS}/lib${TARGETNAMEFLAG}.${SLNAME} ${LIBINSTALLDIR}">>${PJPWD}/Makefile;
        if [ "YES" = "${OBJECTCLEANFLAG}" ]
        then
            echo "	rm -rf ${OBJECTS}/lib${TARGETNAMEFLAG}.${SLNAME} ${fullobjects}">>${PJPWD}/Makefile;
        fi
        
        if [ "X" != "X${INCINSTALLLISTFLAG}" ]
        then
            for icfile in ${INCINSTALLLISTFLAG}
            do
                cat ${PJPWD}/includelist.new|while read dir
                do
                    if [ -f ${dir}/${icfile} ]
                    then
                        echo "	cp -f ${dir}/${icfile} ${INCINSTALLDIR}">>${PJPWD}/Makefile;
                        break;
                    fi
                done
            done
        fi
        echo ".PHONY : uninstall">>${PJPWD}/Makefile;
        echo "uninstall:">>${PJPWD}/Makefile;
        echo "	rm -rf ${LIBINSTALLDIR}/lib${TARGETNAMEFLAG}.${SLNAME}">>${PJPWD}/Makefile;
        if [ "YES" = "${OBJECTCLEANFLAG}" ]
        then
            echo "	rm -rf ${OBJECTS}/lib${TARGETNAMEFLAG}.${SLNAME} ${fullobjects}">>${PJPWD}/Makefile;
        fi
        if [ "X" != "X${INCINSTALLLISTFLAG}" ]
        then
            for icfile in ${INCINSTALLLISTFLAG}
            do
                echo "	rm -rf  ${INCINSTALLDIR}/${icfile}">>${PJPWD}/Makefile;
            done
        fi       


    elif [ ${MAKETYPEFLAG} = "SD" ]
    then
        echo ".PHONY : clean">>${PJPWD}/Makefile;
        echo "clean:">>${PJPWD}/Makefile;
        echo "	rm -rf ${OBJECTS}/lib${TARGETNAMEFLAG}.${SLNAME} ${OBJECTS}/lib${TARGETNAMEFLAG}.a ${fullobjects}">>${PJPWD}/Makefile;
        echo ".PHONY : install">>${PJPWD}/Makefile;
        echo "install:">>${PJPWD}/Makefile;
        echo "	cp -f ${OBJECTS}/lib${TARGETNAMEFLAG}.${SLNAME} ${OBJECTS}/lib${TARGETNAMEFLAG}.a ${LIBINSTALLDIR}">>${PJPWD}/Makefile;
        if [ "YES" = "${OBJECTCLEANFLAG}" ]
        then
            echo "	rm -rf ${OBJECTS}/lib${TARGETNAMEFLAG}.${SLNAME} ${OBJECTS}/lib${TARGETNAMEFLAG}.a ${fullobjects}">>${PJPWD}/Makefile;
        fi
        
        if [ "X" != "X${INCINSTALLLISTFLAG}" ]
        then
            for icfile in ${INCINSTALLLISTFLAG}
            do
                cat ${PJPWD}/includelist.new|while read dir
                do
                    if [ -f ${dir}/${icfile} ]
                    then
                        echo "	cp -f ${dir}/${icfile} ${INCINSTALLDIR}">>${PJPWD}/Makefile;
                        break;
                    fi
                done
            done
        fi
        echo ".PHONY : uninstall">>${PJPWD}/Makefile;
        echo "uninstall:">>${PJPWD}/Makefile;
        echo "	rm -rf ${LIBINSTALLDIR}/lib${TARGETNAMEFLAG}.${SLNAME} ${LIBINSTALLDIR}/lib${TARGETNAMEFLAG}.a">>${PJPWD}/Makefile;
        if [ "YES" = "${OBJECTCLEANFLAG}" ]
        then
            echo "	rm -rf ${OBJECTS}/lib${TARGETNAMEFLAG}.${SLNAME} ${OBJECTS}/lib${TARGETNAMEFLAG}.a ${fullobjects}">>${PJPWD}/Makefile;
        fi
        if [ "X" != "X${INCINSTALLLISTFLAG}" ]
        then
            for icfile in ${INCINSTALLLISTFLAG}
            do
                echo "	rm -rf  ${INCINSTALLDIR}/${icfile}">>${PJPWD}/Makefile;
            done
        fi   
        
    fi 
    rm -rf  ${PJPWD}/makefile ${PJPWD}/config.ini.now ${PJPWD}/list.ini.now ${PJPWD}/objectlist.new ${PJPWD}/includelist.new ${PJPWD}/liblist.new;
    make;
    if [ $? -ne 0 ]
    then
        echo "${TARGETNAMEFLAG} make fail";
        exit -1;
    fi
    make install;
    if [ $? -ne 0 ]
    then
        echo "${TARGETNAMEFLAG} install fail";
        exit -1;
    fi
    cd ${SUPWD};
    
    
    echo "	cd ${PJPWD} && \$(MAKE) && \$(MAKE) install">>${SUPWD}/mkinstall.tmp;
    echo "	cd ${SUPWD}">>${SUPWD}/mkinstall.tmp;
    
    echo "	cd ${PJPWD} && \$(MAKE) uninstall">>${SUPWD}/mkuninstall.tmp;
    echo "	cd ${SUPWD}">>${SUPWD}/mkuninstall.tmp;
    
    echo "	cd ${PJPWD} && \$(MAKE) clean">>${SUPWD}/mkclean.tmp;
    echo "	cd ${SUPWD}">>${SUPWD}/mkclean.tmp;
    
done

rm -rf ${SUPWD}/makefile ${SUPWD}/Makefile;
touch ${SUPWD}/Makefile;


echo "all:">>${SUPWD}/Makefile;


echo ".PHONY : install">>${SUPWD}/Makefile;
echo "install:">>${SUPWD}/Makefile;
cat ${SUPWD}/mkinstall.tmp>>${SUPWD}/Makefile;


echo ".PHONY : uninstall">>${SUPWD}/Makefile;
echo "uninstall:">>${SUPWD}/Makefile;
cat ${SUPWD}/mkuninstall.tmp>>${SUPWD}/Makefile;


echo ".PHONY : clean">>${SUPWD}/Makefile;
echo "clean:">>${SUPWD}/Makefile;
cat ${SUPWD}/mkclean.tmp>>${SUPWD}/Makefile;


rm -rf ${SUPWD}/mkinstall.tmp ${SUPWD}/mkuninstall.tmp ${SUPWD}/mkclean.tmp;
rm -rf ${SUPWD}/config.ini.now ${SUPWD}/list.ini.now ${SUPWD}/project.ini.now ${SUPWD}/prepare.sh;

